<template>
  <div>
    <div>
      <center v-if="user_info">
        欢迎:{{ user_info.user_account }}

        <br /><br /><br />

        {{ greeting.content }}

        <br /><br /><br />

        <span v-if="fes_greeting">{{ fes_greeting.content }}</span>
      </center>
    </div>

    <div>
      <center>
        <van-icon name="good-job-o" size="50" @click="messages1" />
        <van-icon name="flower-o" size="50" @click="messages2" />
        <van-icon name="warning-o" size="50" @click="messages3" />
      </center>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      user_id: localStorage.getItem("id"),
      user_info: "",
      greeting: "",
      fes_greeting: "",
    };
  },
  mounted() {
    this.userinfo();
    this.greetings();
    this.fes_greetings();
  },
  methods: {
    userinfo: function () {
      this.myaxios(this.host + "user/user/" + this.user_id + "/", "get").then(
        (data) => {
          console.log(data);
          if (data.code == 200) {
            this.$toast.success(data.msg);
            this.user_info = data.data;
            console.log(this.user_info);
          } else {
            this.$toast.fail(data.msg);
          }
        }
      );
    },
    greetings: function () {
      this.myaxios(this.host + "user/greetings/", "get").then((data) => {
        console.log(data);
        if (data.code == 200) {
          this.greeting = data.data;
        }
      });
    },
    fes_greetings: function () {
      this.myaxios(this.host + "user/fesgreetings/", "get").then((data) => {
        console.log(data);
        if (data.code == 200) {
          this.fes_greeting = data.data;
        }
      });
    },
  },
};
</script>

<style>
</style>